package com.pb.mapper;

import com.pb.pojo.Score;
import com.pb.pojo.Subject;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.time.LocalDate;

@Mapper
public interface ScoreMapper {

    @Insert("insert into studentresult(id,studentNo,moduleNo,mark,attempt,attemptDate) value (null,#{studentNo},#{moduleNo},#{mark},#{attempt},#{attemptDate})")
    void insert(Score score);

    List<Score> list(String studentName, String moduleName);

    @Select("select stt.*, stu.name as studentName,m.moduleName as moduleName from studentresult stt,student stu,module m where stt.id=#{id} and stt.studentNo=stu.id and m.moduleNo=stt.moduleNo")
    Score getInfo(Integer id);


    void update(Score score);

    @Delete("delete from studentresult where id=#{id}")
    void deleteById(Integer id);

    @Select("select * from studentresult")
    List<Score> findAll();
}
